<%--
  Created by IntelliJ IDEA.
  User: Tate
  Date: 2023/3/8
  Time: 13:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div style="text-align: center;margin-top: 50px;">
    <c:set var="startPage" value="${pageInfo.pageNum}"></c:set>

    <c:if test="${startPage+2>=pageInfo.pages}">
        <c:set var="startPage" value="${pageInfo.pages-2}"></c:set>
    </c:if>




    <ul class="pagination">
        <c:if test="${startPage<=1}">
            <li class="disabled"><a href="javascript:void(0)">&laquo;</a></li>
        </c:if>
        <c:if test="${startPage>1}">
            <li><a href="javascript:page(${pageInfo.pageNum-1})">&laquo;</a></li>
        </c:if>

        <c:forEach begin="${startPage<=0?1:startPage}" end="${startPage+2}" var="v">
            <li><a id="pageA" href="javascript:page(${v})"
                   <c:if test="${pageInfo.pageNum==v}">style="background-color:rgb(1,190,189);color: white" </c:if>>${v}</a>
            </li>
        </c:forEach>

        <c:if test="${pageInfo.pageNum>=pageInfo.pages}">
            <li class="disabled"><a href="javascript:void(0)">&raquo;</a></li>
        </c:if>
        <c:if test="${pageInfo.pageNum<pageInfo.pages}">
            <li><a href="javascript:page(${pageInfo.pageNum+1})">&raquo;</a></li>
        </c:if>

        <li class="disabled"><a>当前页${pageInfo.pageNum}/${pageInfo.pages}总页</a></li>
    </ul>
</div>
